//
//  AFN.m
//  
//
//  Created by Jessica on 15/10/28.
//
//

#import "AFN.h"
#import "AFNetworking.h"
@implementation AFN
+ (void)getdataWithString:(NSString *)string block:(AFNData)block
{
    
    
    AFNetworkReachabilityManager *netWorkManager = [AFNetworkReachabilityManager sharedManager];
    NSString *url_string = [NSString stringWithFormat:@"%@",string];
    
    AFHTTPSessionManager* manager = [AFHTTPSessionManager manager];

    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain", @"text/json", @"application/json", @"text/javascript", @"text/html",  nil];
    [manager GET:url_string parameters:nil success:^(NSURLSessionTask *task, id responseObject) {
        [netWorkManager stopMonitoring];
        block(responseObject);
    } failure:^(NSURLSessionTask *operation, NSError *error) {
        NSLog(@"Error: %@", error);
    
    }];
}
@end
